-- ==
-- input {
--   [ [ [ [1,2,3], [4,5,6] ]
--     ]
--   , [ [ [6,7,8], [9,10,11] ]
--     ]
--   , [ [ [3,2,1], [4,5,6] ]
--     ]
--   , [ [ [8,7,6], [11,10,9] ]
--     ]
--   ]
--   [1,2,3,4]
--   5
-- }
-- output {
--   [[[[7, 8, 9],
--      [10, 11, 12]]],
--    [[[18, 19, 20],
--      [21, 22, 23]]],
--    [[[21, 20, 19],
--      [22, 23, 24]]],
--    [[[32, 31, 30],
--      [35, 34, 33]]]]
-- }
def addToRow [n] (xs: [n]i32, y: i32) : [n]i32 =
  map (\(x: i32) : i32 -> x + y) xs

def main (xssss: [][][][]i32) (cs: []i32) (y: i32) : [][][][]i32 =
  map (\(xsss: [][][]i32, c: i32) ->
         let y' = y * c + c
         in map (\(xss: [][]i32) ->
                   map (\(xs: []i32) ->
                          addToRow (xs, y'))
                       xss)
                xsss)
      (zip xssss cs)
